//
//  UIFont_runtime.swift
//  MyLibrary
//
//  Created by 周博 on 2020/6/18.
//  Copyright © 2020 ncit. All rights reserved.
//

import UIKit

public extension UIFont {

    override open class func initRunTime() {
        exchange(originalSelector: #selector(systemFont(ofSize:)), swizzledSelector: #selector(exchange_systemFont(ofSize:)))
    }

    @objc private class func exchange_systemFont(ofSize: CGFloat)  -> UIFont {

        let scaleSize = SCREEN_WIDTH / standardDeviceWidth * ofSize

        return self.exchange_systemFont(ofSize: scaleSize)
    }
    
    class func mediumFont(size: CGFloat) -> UIFont {
        
        return UIFont.systemFont(ofSize: size, weight: .medium)
    }
    
    class func semiboldFont(size: CGFloat) -> UIFont {
        
        return UIFont.systemFont(ofSize: size, weight: .semibold)
    }
}
